import request from '@/utils/request'

const api_name = '/tenant'

export default {
  // 查询所有用户
  list(pageNum, pageSize, searchObj) {
    return request({
      url: `${api_name}/list/${pageNum}/${pageSize}`,
      method: 'get',
      params: searchObj
    })
  },
  // 新增
  addTenant(functions) {
    return request({
      url: `${api_name}/add`,
      method: 'post',
      data: functions
    })
  },
  // 检查名称是否已存在
  checkIsNameExist(searchObj) {
    return request({
      url: `${api_name}/checkIsNameExist`,
      method: 'get',
      params: searchObj
    })
  },
  // 修改角色
  updateTenant(functions) {
    return request({
      url: `${api_name}/update`,
      method: 'put',
      data: functions
    })
  },
  // 删除角色
  deleteById(id) {
    return request({
      url: `${api_name}/delete/${id}`,
      method: 'delete'
    })
  },
  deleteBatch(ids) {
    return request({
      url: `${api_name}/deleteBatch`,
      method: 'delete',
      data: ids
    })
  },
  batchUpdate(status, ids) {
    return request({
      url: `${api_name}/batchSetStatus/${status}`,
      method: 'put',
      data: ids
    })
  }
}
